<template>
  <div>
    <div>
      <el-table :data="teamData" style="width: 100%" height="725px">
          <el-table-column prop="wid" label="工作室编号" width="180"></el-table-column>
          <el-table-column prop="tname" label="工作室名" width="180"></el-table-column>
          <el-table-column prop="price" label="报价"></el-table-column>
          <el-table-column prop="dateee" label="预定项目完成日期"></el-table-column>

        <!--<el-table-column prop="wid" label="工作室号 "width="180"></el-table-column>-->
        <!--<el-table-column prop="projectName" label="工作室名" width="180"></el-table-column>-->
        <!--<el-table-column prop="price" label="报价"></el-table-column>-->
        <!--<el-table-column prop="timeLimit" label="工期"></el-table-column>-->
        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-button
              size="mini"
              @click="handleEdit(scope.$index, scope.row)">工作室情况</el-button>
            <el-button
              size="mini"
              @click="handleEditt(scope.$index, scope.row)">同意</el-button>
            <el-button
              size="mini"
              type="danger"
              @click="handleDelete(scope.$index, scope.row)">拒绝</el-button>
          </template>
        </el-table-column>
      </el-table>

    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        tid:'',
        tableData: [
          {
            gid:'',
            id:'',
            wid:'',
            projectName:'',
            price:'',
            timeLimit:''
          }
        ],
        teamData:[]
      }
    },
    mounted: function(){

      this.tid = this.$route.query.mallCode  //输入内容


      axios.post('/user/selectTeamApply',{
        tdid: this.tid,
        wid: this.tid
      }).then((response) => {
        if(response.data!=""){





          var ee=response.data
          this.teamData=ee




        }
        else{
          // this.$notify.error({
          //   title: '没有人申请该项目',
          //   message: response.data.message,
          //   type: 'warning',
          //   duration:0
          // });
        }

      }).catch((response)=>{
        this.$notify.error({
          title: '',
          message: '错误'
        });
      })


    },
    methods: {
      handleEdit(index, row) {

          this.$router.push({
            path: '/Workroom',
            query: {
              mallCode:row.wid,
            }
          })
      },

      handleEditt(index, row) {
        console.log(row.wid)
        var ee=row.wid
        axios.post('/workroom/acceptTeamApply',{
          id : row.id,
          wid  : row.id
        }).then((response) => {
          if( response.data.states== 800){
            this.$notify({
              title: '成功',
              message: '成功',
              type: 'success',
              duration:2000
            });

            location.reload()
          } else{
            this.$notify({
              title: '失败',
              message: '操作失败',
              type: 'warning',
              duration:2000
            });
          }
        })


      },
      handleDelete(index, row) {

        var ff=row.id
        var a="1"
        console.log(ff)
        console.log(a)
        axios.post('/company/deleteProjectApply',{
          wid : ff,
          states : a
        }).then((response) => {
          if( response.data.states== 800){
            this.$notify({
              title: '成功',
              message: '成功',
              type: 'success',
              duration:2000
            });
            location.reload()
          }
          else{
            this.$notify({
              title: '失败',
              message: '操作错误',
              type: 'warning',
              duration:2000
            });
          }
        })


      }

    }}
</script>

<style scoped>

</style>
